package com.share.servlet.utils;


import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by leeping on 2016/1/12.
 */
public class ForwardUtils {
	public static void forward(HttpServletRequest request, HttpServletResponse response, String url, ServletContext context) {
		RequestDispatcher rd = context.getRequestDispatcher(url);
		try {
			rd.forward(request, response);
		} catch (ServletException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
